- 
                Notifications
    
You must be signed in to change notification settings  - Fork 38
 
ai-assistant: Add ability to run mcp server from ai-assistant plugin #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
aa9aa8e    to
    3bd4cbb      
    Compare
  
    10b04e6    to
    1b93e58      
    Compare
  
    2620b42    to
    fe38c68      
    Compare
  
    c81b4a7    to
    628ad14      
    Compare
  
    a2c1b1f    to
    de28bed      
    Compare
  
    Signed-off-by: Ashu Ghildiyal <[email protected]> Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: Ashu Ghildiyal <[email protected]> Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: Ashu Ghildiyal <[email protected]> Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: Ashu Ghildiyal <[email protected]> Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: Ashu Ghildiyal <[email protected]> Signed-off-by: ashu8912 <[email protected]>
- Add MCPOutputFormatter for AI-powered formatting of MCP tool outputs - Add MCPOutputDisplay component for rendering formatted MCP results - Add MCPFormattedMessage component for displaying MCP messages in chat - Support multiple output types: table, metrics, list, graph, text, error - Include insights, warnings, and actionable items in formatted output - Add comprehensive argument processing and validation Signed-off-by: ashu8912 <[email protected]>
- Add PromptWidthContext to eliminate prop drilling for width state - Add PromptWidthProvider wrapper in AIPanelComponent - Enable components to access prompt width through usePromptWidth hook - Improve state management across the component hierarchy Signed-off-by: ashu8912 <[email protected]>
- Add InlineToolConfirmation component for embedded tool approval UI - Add InlineToolApprovalManager for managing tool confirmation state - Extend ToolApprovalDialog with inline approval capabilities - Add support for tool confirmation in Prompt interface - Enable seamless tool approval workflow within chat interface Signed-off-by: ashu8912 <[email protected]>
- Add ToolsDialog component for displaying and managing AI tools - Provide interface for viewing tool configurations and capabilities - Export ToolsDialog in assistant components index Signed-off-by: ashu8912 <[email protected]>
…gration - Add originalArgs storage in tool response metadata for retry capability - Integrate MCPOutputFormatter for AI-powered output formatting - Improve MCP tool argument mapping and validation - Add comprehensive error handling and formatting for tool failures - Include originalArgs in all formatted outputs (success, error, fallback) - Enable tool retry functionality through stored execution arguments Signed-off-by: ashu8912 <[email protected]>
- Add MCPFormattedMessage integration to ContentRenderer - Add onRetryTool prop propagation through component hierarchy - Integrate prompt width context usage in components - Add MCP tool retry functionality to chat interface - Update TextStreamContainer and AIChatContent with retry support Signed-off-by: ashu8912 <[email protected]>
- Add handleRetryTool function for re-executing failed tools - Integrate inline tool approval manager for seamless confirmations - Add comprehensive tool response processing and error handling - Implement suggestion parsing and display from AI responses - Add retry capability propagation to chat components - Improve user experience with better tool interaction workflow Signed-off-by: ashu8912 <[email protected]>
- Add comprehensive tool response processing and validation - Implement intelligent message preparation for tool contexts - Add specialized system prompts for tool response handling - Improve tool call alignment validation and error handling - Add content size management to prevent memory issues - Enhance user context building with conversation history and tool results - Support multiple provider compatibility (Azure, Anthropic, etc.) Signed-off-by: ashu8912 <[email protected]>
- Add MCPConfigEditorDialog with Monaco Editor integration - Provide syntax highlighting and auto-formatting for JSON configurations - Include tabbed interface with Configuration Editor and Schema Documentation - Add real-time validation with clear error messages - Support for environment variables in server configuration - Include comprehensive schema documentation with field descriptions - Add Load Example and Reset functionality for easy configuration management Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
The "white-space: pre-wrap" left lots of spacing around the text. Signed-off-by: Joaquim Rocha <[email protected]> Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: Joaquim Rocha <[email protected]> Signed-off-by: ashu8912 <[email protected]>
So we don't show very long descriptions in the tools dialog. Signed-off-by: Joaquim Rocha <[email protected]> Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: Joaquim Rocha <[email protected]> Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: Joaquim Rocha <[email protected]> Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: Joaquim Rocha <[email protected]> Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
Signed-off-by: ashu8912 <[email protected]>
e709bb6    to
    1f9cd8a      
    Compare
  
    Signed-off-by: ashu8912 <[email protected]>
1f9cd8a    to
    d9bb4cb      
    Compare
  
    Instead of just relying on editing JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important to do these standard things for PRs to speed reviews along:
- PR description
 - screenshots or video
 - steps to test each fix or piece of functionality
 - link to the related issue
 - If there are no tests at all, please justify this. Note that it will slow reviews down, and slow down future changes
 - Document fields and functions. This speeds up the review, and helps speed up further changes.
 - git commit messages with context of the modules changed in subject, AND a "why" in the git commit body unless it's covered in the git message subject.
 
ai-assistant: MCPSettings: Add MCP settings UI and Electron config API
- Add components/settings/MCPSettings.tsx: UI for configuring MCP servers (add/remove/toggle/edit),
  uses window.desktopApi.mcp.getConfig/updateConfig when running in Electron, falls back to pluginStore.
- Extend ElectronMCPApi typings with getConfig and updateConfig for config persistence.
- Provide default server when enabling MCP with no servers, and a "Test MCP Connection" action.
Notes:
- Argument parsing is space-based (no quote handling).
- Ensure native side exposes getTools (used by the test action) and that updateConfig triggers any required client restart.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive MCP (Model Context Protocol) integration to the AI assistant, enabling connection to external tools and services. It introduces tool approval workflows, intelligent argument processing, and enhanced tool management capabilities.
- Added MCP server configuration and management in Electron environments
 - Implemented tool approval dialogs with inline confirmation UI
 - Created intelligent argument processing using AI for MCP tools
 - Added tool orchestration for multi-tool execution
 
Reviewed Changes
Copilot reviewed 40 out of 42 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description | 
|---|---|
| ai-assistant/src/utils/ToolConfigManager.ts | Added source tracking ('built-in' vs 'mcp'), MCP tool integration functions, and tool state initialization | 
| ai-assistant/src/utils/ToolApprovalManager.ts | New approval manager for tool execution with session-based auto-approval | 
| ai-assistant/src/utils/InlineToolApprovalManager.ts | Inline tool approval with user context extraction for intelligent argument processing | 
| ai-assistant/src/langchain/tools/ToolManager.ts | Enhanced with MCP tool support, argument mapping, and formatter integration | 
| ai-assistant/src/langchain/tools/ToolOrchestrator.ts | New orchestrator for analyzing and coordinating multi-tool execution | 
| ai-assistant/src/langchain/formatters/MCPOutputFormatter.ts | AI-powered formatter for MCP tool output with markdown support | 
| ai-assistant/src/langchain/LangChainManager.ts | Major updates for tool orchestration, inline approval, and argument enhancement | 
| ai-assistant/src/components/mcpOutput/MCPOutputDisplay.tsx | Rich UI component for displaying formatted MCP tool results | 
| ai-assistant/src/components/mcpOutput/MCPArgumentProcessor.ts | Intelligent argument processing with schema validation | 
| ai-assistant/src/components/settings/MCPSettings.tsx | MCP server configuration UI with enable/disable controls | 
| ai-assistant/src/components/common/InlineToolConfirmation.tsx | Inline tool confirmation component (exported via index) | 
| ai-assistant/src/types/electron.d.ts | TypeScript definitions for Electron MCP API | 
| ai-assistant/src/hooks/useClusterChangeNotifier.ts | Hook for monitoring cluster changes and notifying MCP servers | 
Files not reviewed (1)
- ai-assistant/package-lock.json: Language not supported
 
Comments suppressed due to low confidence (2)
ai-assistant/src/langchain/tools/ToolManager.ts:226
- This statement is unreachable.
ai-assistant/src/langchain/tools/ToolManager.ts:258 - This statement is unreachable.
 
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return this.filterMCPArguments(inputValue, inputSchema); | ||
| return this.filterMCPArguments(inputValue, inputSchema); | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate return statement on lines 225-226. The second return is unreachable and should be removed.
| return inputValue; | ||
| return inputValue; | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate return statement on lines 257-258. The second return is unreachable and should be removed.
| import { | ||
| Alert, | ||
| Box, | ||
| Button, | ||
| DialogActions, | ||
| DialogContent, | ||
| DialogTitle, | ||
| FormControlLabel, | ||
| IconButton, | ||
| Paper, | ||
| Switch, | ||
| TextField, | ||
| Typography, | ||
| } from '@mui/material'; | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import Paper.
| import { | ||
| Alert, | ||
| Box, | ||
| Button, | ||
| Chip, | ||
| DialogActions, | ||
| DialogContent, | ||
| DialogTitle, | ||
| FormControlLabel, | ||
| IconButton, | ||
| Paper, | ||
| Switch, | ||
| Table, | ||
| TableBody, | ||
| TableCell, | ||
| TableContainer, | ||
| TableHead, | ||
| TableRow, | ||
| TextField, | ||
| Tooltip, | ||
| Typography, | ||
| } from '@mui/material'; | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import Chip.
| ): FormattedMCPOutput { | ||
| // Try to detect if it's JSON | ||
| let data: any; | ||
| let type: FormattedMCPOutput['type'] = 'text'; | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial value of type is unused, since it is always overwritten.
| let type: FormattedMCPOutput['type'] = 'text'; | |
| let type: FormattedMCPOutput['type']; | 
| cursor: isActionInProgress ? 'not-allowed' : 'pointer', | ||
| }} | ||
| > | ||
| {isDenying ? 'Denying...' : 'Deny'} | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This use of variable 'isDenying' always evaluates to false.
| size="small" | ||
| onClick={handleApprove} | ||
| startIcon={ | ||
| isApproving ? ( | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This use of variable 'isApproving' always evaluates to false.
| } | ||
| color="primary" | ||
| sx={{ | ||
| opacity: isApproving ? 0.7 : 1, | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This use of variable 'isApproving' always evaluates to false.
| cursor: isActionInProgress ? 'not-allowed' : 'pointer', | ||
| }} | ||
| > | ||
| {isApproving | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This use of variable 'isApproving' always evaluates to false.
| } | ||
| 
               | 
          ||
| // First, check if args is properly structured for the schema | ||
| if (args && typeof args === 'object') { | 
    
      
    
      Copilot
AI
    
    
    
      Nov 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This use of variable 'args' always evaluates to true.
No description provided.